<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用户列表</title>
		<!-- 导入JS函数类库 -->
		<script src="./jquery-3.6.0.min.js"></script>
		<script>
			//jQuery语法: 让整个页面浏览器加载完成之后,再次执行JS
			$(function(){
				$.ajax({
					type:"get",
					url: "http://localhost:8090/user/findAll",
					//data:{id:100,name:"tom",age:18},
					success:function(data){
						/* for(var i=0;i<data.length;i++){
							console.log(data[i]};
						} */
						for(user of data){
							let tr = 
							`<tr align="center">
								<td>${user.id}</td>
								<td>${user.name}</td>
								<td>${user.age}</td>
								<td>${user.sex}</td>
								<td><a href="#">update</a> | 
									<a href="#">delete</a>
								</td>
							</tr>`;
							$("table").append(tr);
						}
					}	
				})
			})
		</script>
		
	</head>
	<body>
		<table border="1px" width="80%" align="center" cellpadding="1" cellspacing="0">
			<tr>
				<th colspan="5"><h2>用户列表</h2></th>
			</tr>
			<tr align="center" height="30px">
				<th>编号</th>
				<th>名称</th>
				<th>年龄</th>
				<th>性别</th>
				<th>操作</th>
			</tr>
			
			
		</table>
	</body>
</html>
